package com.pg.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.pg.mapper.CjsjMapper;
import com.pg.service.CjsjService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.HashMap;

/**
 * <p>
 * 采集数据 服务实现类
 * </p>
 *
 * @author likl
 * @since 2020-07-06
 */
@Service
@DS("proxyDs")
@Primary
public class CjsjServiceImpl implements CjsjService {

    @Autowired
    private CjsjMapper cjsjMapper;

    @Override
    public int hgjCount(HashMap<String, Object> hgjwdMap) {
        String supplierCode = (String) hgjwdMap.get("supplierCode");
        String categoryCode = (String) hgjwdMap.get("categoryCode");
        Date startTime = (Date) hgjwdMap.get("startTime");
        Date endTime = (Date) hgjwdMap.get("endTime");
        if ("1000015019".equals(supplierCode) && "40001".equals(categoryCode)) {
            return cjsjMapper.hgjwdCount("zpg_eip_zhdq", startTime, endTime);
        }
        if ("1000015019".equals(supplierCode) && "40002".equals(categoryCode)) {
            return cjsjMapper.hgjwdCount("zpg_eip_dlq", startTime, endTime);
        }
        if ("1000014563".equals(supplierCode) && "40001".equals(categoryCode)) {
            return cjsjMapper.hgjwdCount("zpz_eip_zhdq", startTime, endTime);
        }
        return 0;
    }

    @Override
    public int wzjCount(HashMap<String, Object> wzjMap) {
        String supplierCode = (String) wzjMap.get("supplierCode");
        String categoryCode = (String) wzjMap.get("categoryCode");
        Date startTime = (Date) wzjMap.get("startTime");
        Date endTime = (Date) wzjMap.get("endTime");
        if ("1000015019".equals(supplierCode) && "40001".equals(categoryCode)) {
            return cjsjMapper.wzjCount("zpg_eip_zhdq", startTime, endTime);
        }
        if ("1000015019".equals(supplierCode) && "40002".equals(categoryCode)) {
            return cjsjMapper.wzjCount("zpg_eip_dlq", startTime, endTime);
        }
        if ("1000014563".equals(supplierCode) && "40001".equals(categoryCode)) {
            return cjsjMapper.wzjCount("zpz_eip_zhdq", startTime, endTime);
        }
        return 0;
    }

    @Override
    public int nzjCount(HashMap<String, Object> nzjMap) {
        String supplierCode = (String) nzjMap.get("supplierCode");
        String categoryCode = (String) nzjMap.get("categoryCode");
        Date startTime = (Date) nzjMap.get("startTime");
        Date endTime = (Date) nzjMap.get("endTime");
        if ("1000015019".equals(supplierCode) && "40001".equals(categoryCode)) {
            return cjsjMapper.nzjCount("zpg_eip_zhdq", startTime, endTime);
        }
        if ("1000015019".equals(supplierCode) && "40002".equals(categoryCode)) {
            return cjsjMapper.nzjCount("zpg_eip_dlq", startTime, endTime);
        }
        if ("1000014563".equals(supplierCode) && "40001".equals(categoryCode)) {
            return cjsjMapper.nzjCount("zpz_eip_zhdq", startTime, endTime);
        }
        return 0;
    }
}
